3.64 \(\int \frac{1}{a+b \tan ^2(e+f x)} \, dx\)

Optimal. Leaf size=50 \[ \frac{x}{a-b}-\frac{\sqrt{b} \tan ^{-1}\left (\frac{\sqrt{b} \tan (e+f x)}{\sqrt{a}}\right )}{\sqrt{a} f (a-b)} \]

[Out]

x/(a - b) - (Sqrt[b]*ArcTan[(Sqrt[b]*Tan[e + f*x])/Sqrt[a]])/(Sqrt[a]*(a - b)*f)

________________________________________________________________________________________

Rubi [A]  time = 0.0747476, antiderivative size = 50, normalized size of antiderivative = 1., number of steps used = 3, number of rules used = 3, integrand size = 14, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.214, Rules used = {3660, 3675, 205} \[ \frac{x}{a-b}-\frac{\sqrt{b} \tan ^{-1}\left (\frac{\sqrt{b} \tan (e+f x)}{\sqrt{a}}\right )}{\sqrt{a} f (a-b)} \]

Antiderivative was successfully verified.

[In]

Int[(a + b*Tan[e + f*x]^2)^(-1),x]

[Out]

x/(a - b) - (Sqrt[b]*ArcTan[(Sqrt[b]*Tan[e + f*x])/Sqrt[a]])/(Sqrt[a]*(a - b)*f)

Rule 3660

Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)]^2)^(-1), x_Symbol] :> Simp[x/(a - b), x] - Dist[b/(a - b), Int[Sec[e
 + f*x]^2/(a + b*Tan[e + f*x]^2), x], x] /; FreeQ[{a, b, e, f}, x] && NeQ[a, b]

Rule 3675

Int[sec[(e_.) + (f_.)*(x_)]^(m_)*((a_) + (b_.)*((c_.)*tan[(e_.) + (f_.)*(x_)])^(n_))^(p_.), x_Symbol] :> With[
{ff = FreeFactors[Tan[e + f*x], x]}, Dist[ff/(c^(m - 1)*f), Subst[Int[(c^2 + ff^2*x^2)^(m/2 - 1)*(a + b*(ff*x)
^n)^p, x], x, (c*Tan[e + f*x])/ff], x]] /; FreeQ[{a, b, c, e, f, n, p}, x] && IntegerQ[m/2] && (IntegersQ[n, p
] || IGtQ[m, 0] || IGtQ[p, 0] || EqQ[n^2, 4] || EqQ[n^2, 16])

Rule 205

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(Rt[a/b, 2]*ArcTan[x/Rt[a/b, 2]])/a, x] /; FreeQ[{a, b}, x]
&& PosQ[a/b]

Rubi steps

\begin{align*} \int \frac{1}{a+b \tan ^2(e+f x)} \, dx &=\frac{x}{a-b}-\frac{b \int \frac{\sec ^2(e+f x)}{a+b \tan ^2(e+f x)} \, dx}{a-b}\\ &=\frac{x}{a-b}-\frac{b \operatorname{Subst}\left (\int \frac{1}{a+b x^2} \, dx,x,\tan (e+f x)\right )}{(a-b) f}\\ &=\frac{x}{a-b}-\frac{\sqrt{b} \tan ^{-1}\left (\frac{\sqrt{b} \tan (e+f x)}{\sqrt{a}}\right )}{\sqrt{a} (a-b) f}\\ \end{align*}

Mathematica [A]  time = 0.065608, size = 49, normalized size = 0.98 \[ \frac{\tan ^{-1}(\tan (e+f x))-\frac{\sqrt{b} \tan ^{-1}\left (\frac{\sqrt{b} \tan (e+f x)}{\sqrt{a}}\right )}{\sqrt{a}}}{a f-b f} \]

Antiderivative was successfully verified.

[In]

Integrate[(a + b*Tan[e + f*x]^2)^(-1),x]

[Out]

(ArcTan[Tan[e + f*x]] - (Sqrt[b]*ArcTan[(Sqrt[b]*Tan[e + f*x])/Sqrt[a]])/Sqrt[a])/(a*f - b*f)

________________________________________________________________________________________

Maple [A]  time = 0.019, size = 52, normalized size = 1. \begin{align*} -{\frac{b}{f \left ( a-b \right ) }\arctan \left ({b\tan \left ( fx+e \right ){\frac{1}{\sqrt{ab}}}} \right ){\frac{1}{\sqrt{ab}}}}+{\frac{\arctan \left ( \tan \left ( fx+e \right ) \right ) }{f \left ( a-b \right ) }} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(1/(a+b*tan(f*x+e)^2),x)

[Out]

-1/f/(a-b)*b/(a*b)^(1/2)*arctan(b*tan(f*x+e)/(a*b)^(1/2))+1/f/(a-b)*arctan(tan(f*x+e))

________________________________________________________________________________________

Maxima [F(-2)]  time = 0., size = 0, normalized size = 0. \begin{align*} \text{Exception raised: ValueError} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(1/(a+b*tan(f*x+e)^2),x, algorithm="maxima")

[Out]

Exception raised: ValueError

________________________________________________________________________________________

Fricas [A]  time = 1.68936, size = 406, normalized size = 8.12 \begin{align*} \left [\frac{4 \, f x - \sqrt{-\frac{b}{a}} \log \left (\frac{b^{2} \tan \left (f x + e\right )^{4} - 6 \, a b \tan \left (f x + e\right )^{2} + a^{2} + 4 \,{\left (a b \tan \left (f x + e\right )^{3} - a^{2} \tan \left (f x + e\right )\right )} \sqrt{-\frac{b}{a}}}{b^{2} \tan \left (f x + e\right )^{4} + 2 \, a b \tan \left (f x + e\right )^{2} + a^{2}}\right )}{4 \,{\left (a - b\right )} f}, \frac{2 \, f x - \sqrt{\frac{b}{a}} \arctan \left (\frac{{\left (b \tan \left (f x + e\right )^{2} - a\right )} \sqrt{\frac{b}{a}}}{2 \, b \tan \left (f x + e\right )}\right )}{2 \,{\left (a - b\right )} f}\right ] \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(1/(a+b*tan(f*x+e)^2),x, algorithm="fricas")

[Out]

[1/4*(4*f*x - sqrt(-b/a)*log((b^2*tan(f*x + e)^4 - 6*a*b*tan(f*x + e)^2 + a^2 + 4*(a*b*tan(f*x + e)^3 - a^2*ta
n(f*x + e))*sqrt(-b/a))/(b^2*tan(f*x + e)^4 + 2*a*b*tan(f*x + e)^2 + a^2)))/((a - b)*f), 1/2*(2*f*x - sqrt(b/a
)*arctan(1/2*(b*tan(f*x + e)^2 - a)*sqrt(b/a)/(b*tan(f*x + e))))/((a - b)*f)]

________________________________________________________________________________________

Sympy [A]  time = 3.63093, size = 280, normalized size = 5.6 \begin{align*} \begin{cases} \frac{\tilde{\infty } x}{\tan ^{2}{\left (e \right )}} & \text{for}\: a = 0 \wedge b = 0 \wedge f = 0 \\\frac{x}{a} & \text{for}\: b = 0 \\\frac{- x - \frac{1}{f \tan{\left (e + f x \right )}}}{b} & \text{for}\: a = 0 \\\frac{f x \tan ^{2}{\left (e + f x \right )}}{2 b f \tan ^{2}{\left (e + f x \right )} + 2 b f} + \frac{f x}{2 b f \tan ^{2}{\left (e + f x \right )} + 2 b f} + \frac{\tan{\left (e + f x \right )}}{2 b f \tan ^{2}{\left (e + f x \right )} + 2 b f} & \text{for}\: a = b \\\frac{x}{a + b \tan ^{2}{\left (e \right )}} & \text{for}\: f = 0 \\\frac{2 i \sqrt{a} f x \sqrt{\frac{1}{b}}}{2 i a^{\frac{3}{2}} f \sqrt{\frac{1}{b}} - 2 i \sqrt{a} b f \sqrt{\frac{1}{b}}} - \frac{\log{\left (- i \sqrt{a} \sqrt{\frac{1}{b}} + \tan{\left (e + f x \right )} \right )}}{2 i a^{\frac{3}{2}} f \sqrt{\frac{1}{b}} - 2 i \sqrt{a} b f \sqrt{\frac{1}{b}}} + \frac{\log{\left (i \sqrt{a} \sqrt{\frac{1}{b}} + \tan{\left (e + f x \right )} \right )}}{2 i a^{\frac{3}{2}} f \sqrt{\frac{1}{b}} - 2 i \sqrt{a} b f \sqrt{\frac{1}{b}}} & \text{otherwise} \end{cases} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(1/(a+b*tan(f*x+e)**2),x)

[Out]

Piecewise((zoo*x/tan(e)**2, Eq(a, 0) & Eq(b, 0) & Eq(f, 0)), (x/a, Eq(b, 0)), ((-x - 1/(f*tan(e + f*x)))/b, Eq
(a, 0)), (f*x*tan(e + f*x)**2/(2*b*f*tan(e + f*x)**2 + 2*b*f) + f*x/(2*b*f*tan(e + f*x)**2 + 2*b*f) + tan(e +
f*x)/(2*b*f*tan(e + f*x)**2 + 2*b*f), Eq(a, b)), (x/(a + b*tan(e)**2), Eq(f, 0)), (2*I*sqrt(a)*f*x*sqrt(1/b)/(
2*I*a**(3/2)*f*sqrt(1/b) - 2*I*sqrt(a)*b*f*sqrt(1/b)) - log(-I*sqrt(a)*sqrt(1/b) + tan(e + f*x))/(2*I*a**(3/2)
*f*sqrt(1/b) - 2*I*sqrt(a)*b*f*sqrt(1/b)) + log(I*sqrt(a)*sqrt(1/b) + tan(e + f*x))/(2*I*a**(3/2)*f*sqrt(1/b)
- 2*I*sqrt(a)*b*f*sqrt(1/b)), True))

________________________________________________________________________________________

Giac [B]  time = 1.39468, size = 231, normalized size = 4.62 \begin{align*} -\frac{2 \,{\left (\frac{\sqrt{a b}{\left (\pi \left \lfloor \frac{f x + e}{\pi } + \frac{1}{2} \right \rfloor + \arctan \left (\frac{2 \, \sqrt{\frac{1}{2}} \tan \left (f x + e\right )}{\sqrt{\frac{a + b - \sqrt{{\left (a + b\right )}^{2} - 4 \, a b}}{b}}}\right )\right )}{\left | b \right |}}{{\left (a - b\right )}^{2} b -{\left (a b + b^{2}\right )}{\left | -a + b \right |}} + \frac{{\left (\pi \left \lfloor \frac{f x + e}{\pi } + \frac{1}{2} \right \rfloor + \arctan \left (\frac{2 \, \sqrt{\frac{1}{2}} \tan \left (f x + e\right )}{\sqrt{\frac{a + b + \sqrt{{\left (a + b\right )}^{2} - 4 \, a b}}{b}}}\right )\right )} b}{{\left (a - b\right )}^{2} + a{\left | -a + b \right |} + b{\left | -a + b \right |}}\right )}}{f} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(1/(a+b*tan(f*x+e)^2),x, algorithm="giac")

[Out]

-2*(sqrt(a*b)*(pi*floor((f*x + e)/pi + 1/2) + arctan(2*sqrt(1/2)*tan(f*x + e)/sqrt((a + b - sqrt((a + b)^2 - 4
*a*b))/b)))*abs(b)/((a - b)^2*b - (a*b + b^2)*abs(-a + b)) + (pi*floor((f*x + e)/pi + 1/2) + arctan(2*sqrt(1/2
)*tan(f*x + e)/sqrt((a + b + sqrt((a + b)^2 - 4*a*b))/b)))*b/((a - b)^2 + a*abs(-a + b) + b*abs(-a + b)))/f